package com.wb3.organizer.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * 用户帐号实体类
 * 主键：acc_id, 用户名：username, 密码：password, 主题：theme, 邮箱：email
 * @author pharen
 */

@Entity
@Table(name="account")
public class Account implements Cloneable {

	private int acc_id;
	
	private String username;
	
	private String password;
	
	private int theme;
	
	private String email;

	@Id
	@Column(name="acc_id")
	@GeneratedValue(strategy=GenerationType.AUTO)
	public int getAcc_id() {
		return acc_id;
	}

	public void setAcc_id(int acc_id) {
		this.acc_id = acc_id;
	}

	@Column(name="username", unique=true, nullable=false)
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	@Column(name="password", nullable=false)
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name="theme", columnDefinition="int default 3")
	public int getTheme() {
		return theme;
	}

	public void setTheme(int theme) {
		this.theme = theme;
	}
	
	@Column(name="email")
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * 重写clone()方法,获取account的副本
	 */
	public Account clone() throws CloneNotSupportedException {
		return (Account) super.clone();
	}
	
}
